package org.example.lotterysystem.controller;

import jakarta.annotation.Resource;
import org.example.lotterysystem.common.domain.Result;
import org.example.lotterysystem.common.domain.dto.CreateActivityDTO;
import org.example.lotterysystem.common.domain.dto.PageDTO;
import org.example.lotterysystem.common.domain.vo.CreateActivityVO;
import org.example.lotterysystem.common.domain.vo.FindActivityListVO;
import org.example.lotterysystem.common.domain.vo.GetActivityDetailVO;
import org.example.lotterysystem.service.ActivityService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ActivityController {
    @Resource
    ActivityService activityService;

    /**
     * 创建活动
     */
    @RequestMapping("/activity/create")
    public Result<CreateActivityVO> createActivity(
            @Validated @RequestBody CreateActivityDTO createActivityDTO){
        return Result.success(activityService.createActivity(createActivityDTO));
    }

    /**
     * 获取活动列表
     */
    @RequestMapping("/activity/find-list")
    public Result<FindActivityListVO> findActivityList(PageDTO pageDTO){
        return Result.success(activityService.findActivityList(pageDTO));
    }

    /**
     * 查询活动详细信息
     */
    @RequestMapping("/activity-detail/find")
    public Result<GetActivityDetailVO> getActivityDetail(Long activityId){
        return Result.success(activityService.getActivityDetail(activityId));
    }
}
